package com.sdk.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class SharePreferenceUtil {
	SharedPreferences mSharedPreferences;

	public SharePreferenceUtil(Context context) {
		mSharedPreferences = PreferenceManager
				.getDefaultSharedPreferences(context);
	}

	public void saveInt(String key, int value) {
		mSharedPreferences.edit().putInt(key, value).commit();
	}

	public int getInt(String key, int defaultValue) {
		return mSharedPreferences.getInt(key, defaultValue);
	}

	public void saveString(String key, String value) {
		mSharedPreferences.edit().putString(key, value).commit();
	}

	public String getString(String key, String defaultValue) {
		return mSharedPreferences.getString(key, defaultValue);
	}

	public void saveBoolean(String key, Boolean value) {
		mSharedPreferences.edit().putBoolean(key, value).commit();
	}

	public Boolean getBoolean(String key, Boolean defaultValue) {
		return mSharedPreferences.getBoolean(key, defaultValue);
	}

	public void saveLong(String key, Long value) {
		mSharedPreferences.edit().putLong(key, value).commit();
	}

	public long getLong(String key, Long value) {
		return mSharedPreferences.getLong(key, value);
	}
}
